#include <iostream>
#include <string>
#include <ballade/util.h>

#include "io_error_test.h"

namespace Ballade
{
	
	namespace Util
	{
		using std::string;
		using std::cout;
		using std::endl;
		
		CPPUNIT_TEST_SUITE_REGISTRATION(IOErrorTest);
		
		void IOErrorTest::testIOError()
		{
			string msg("A sample error");
			string typeName("class Ballade::Util::IOError");
			try
			{
				throw IOError(msg);
			}
			catch(IOError &e)
			{
				CPPUNIT_ASSERT(strncmp(msg.c_str(), e.what(), msg.length()) == 0);
				CPPUNIT_ASSERT(strncmp(typeName.c_str(), typeid(e).name(), typeName.length()) == 0);
			}
		}
	}

}